from datetime import date
from enum import Enum

# 订单状态枚举
class OrderStatus(Enum):
    CREATE = "Create"
    PAID = "Paid"
    SHIPPING = "Shipping"
    DELIVERED = "Delivered"
    CANCEL = "Cancel"


# 客户类
class Customer:
    def __init__(self, name, contact, delivery_address, active=True):
        self.name = name                      # 姓名
        self.contact = contact                # 联系电话
        self.delivery_address = delivery_address  # 邮寄地址
        self.active = active                  # 激活状态
        self.orders = []                      # 客户可以有多个订单

    def add_order(self, order):
        self.orders.append(order)


# 订单类
class Order:
    def __init__(self, create_date, status=OrderStatus.CREATE):
        self.create_date = create_date        # 创建日期
        self.status = status                  # 订单状态
        self.order_details = []               # 订单可以包含多个订单详情
        self.payment = None                   # 每个订单对应一个支付方式

    def add_order_detail(self, order_detail):
        self.order_details.append(order_detail)

    def set_payment(self, payment):
        self.payment = payment


# 订单详情类
class OrderDetail:
    def __init__(self, product, quantity):
        self.product = product                # 关联的商品项
        self.quantity = quantity              # 数量

    def calculate_sub_total(self):
        return self.product.get_price_for_quantity(self.quantity)

    def calculate_weight(self):
        return self.product.get_weight() * self.quantity


# 商品类
class Product:
    def __init__(self, title, weight, description):
        self.title = title                    # 商品名称
        self.weight = weight                  # 重量
        self.description = description        # 描述

    def get_price_for_quantity(self, quantity):
        # 假设一个简单的价格逻辑
        return quantity * 10.0  # 价格示例

    def get_weight(self):
        return self.weight


# 支付方式基类
class Payment:
    def __init__(self, amount):
        self.amount = amount                  # 支付金额


# 信用卡支付
class Credit(Payment):
    def __init__(self, amount, number, card_type, expire_date):
        super().__init__(amount)
        self.number = number                  # 卡号
        self.card_type = card_type            # 类型
        self.expire_date = expire_date        # 过期日期


# 现金支付
class Cash(Payment):
    def __init__(self, amount, cash_tendered):
        super().__init__(amount)
        self.cash_tendered = cash_tendered    # 支付金额


# 在线转账支付
class WireTransfer(Payment):
    def __init__(self, amount, bank_id, bank_name):
        super().__init__(amount)
        self.bank_id = bank_id                # 银行ID
        self.bank_name = bank_name            # 银行名称


# 支付宝支付
class AliPay(Payment):
    def __init__(self, amount, number):
        super().__init__(amount)
        self.number = number                  # 支付宝卡号


# 微信支付
class WeixinPay(Payment):
    def __init__(self, amount, number):
        super().__init__(amount)
        self.number = number                  # 微信卡号

